'use strict';
const {
  Model
} = require('sequelize');
module.exports = (sequelize, DataTypes) => {
  class bookinfo extends Model {
    /**
     * Helper method for defining associations.
     * This method is not a part of Sequelize lifecycle.
     * The `models/index` file will call this method automatically.
     */
    static associate(models) {
      // define association here
      models.bookinfo.belongsTo(models.User,{foreignKey:'userId',as:'User'})
      models.bookinfo.belongsTo(models.Laboratory,{foreignKey:'bookLaboratoryId',as:'Laboratory'})
      models.bookinfo.belongsTo(models.Equipment,{foreignKey:'bookEquipmentId',as:'Equipment'})
    }
  }
  bookinfo.init({
    userId: DataTypes.INTEGER,
    bookLaboratoryId: DataTypes.INTEGER,
    bookEquipmentId: DataTypes.INTEGER,
    startTime: DataTypes.STRING,
    endTime: DataTypes.STRING
  }, {
    sequelize,
    modelName: 'bookinfo',
  });
  return bookinfo;
};